export default function($rootScope,$http){
    return{
        "get":function(url,data,successCall,errorCall){
            $http({
                "method":"get",
                "url":url,
                "data":data
            })
            .success(function(data){
                successCall(data)
            })
            .error(function(data){
                if(errorCall){
                     errorCall(data)
                }
               
            })
        },
        "post":function(selector,url,successCall,errorCall){
            console.log($(selector));
            $(selector).ajaxSubmit({
                type: "post",
                dataType: "json",
                url:url,
                success:function(data){
                    successCall(data);
                },
                fail:function(data){
                   if(errorCall){
                        errorCall(data)
                    }
                }
            })
        }
    }
}